//
//  XHZDemoController.swift
//  Weibo
//
//  Created by 许惠占 on 2017/7/14.
//  Copyright © 2017年 许惠占. All rights reserved.
//

import UIKit

class XHZDemoController: XHZBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // 设置标题
        title = "第 \(navigationController?.childViewControllers.count ?? 0) 个"
    }
    
    // MARK: - 监听方法
    @objc fileprivate func showNext() {
        let vc = XHZDemoController()
        
        navigationController?.pushViewController(vc, animated: true)
    }
    
}

extension XHZDemoController {
    
    /// 重写父类方法
    override func setupUI() {
        
        super.setupUI()
        
        // 设置右侧的控制器
//        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", style: .plain, target: self, action: #selector(showNext))
//        let btn: UIButton = UIButton.cz_textButton("下一个", fontSize: 16, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
//        btn.addTarget(self, action: #selector(showNext), for: .touchUpInside)
//        
//        navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn)
        navItem.rightBarButtonItem = UIBarButtonItem(title: "下一步", target: self, action: #selector(showNext))

    }
}
